<?php
/**
 * User Groups and Authorization
 * 
 * Admin screen that display current user profile, authorizations, and
 * groups
 * 
 * @author Xavier VILAIN
 * @package Hive\User
 * @license #license-hive-social#
 */
$xview = Xview::instance();
$id = $xview->application()->getId();
// Customizing
$customizing = Hive\User\Customizing::instance();
$customizing->trackSummaryPage(array('mod' => 'users','act'=>'authorization','sac' => null));

// Capture LinkedIn Connection Code
$user = User::current();
$last_update = Msg(Hive::BUNDLE,Hive::LAST_CONNECTION_ON,
					Fox\Utilities\DateTimes::toFullString($user->lastConnectionOn()));

// Page Title
$header = new Fox\Html\Header\Content('page-header',Msg(Hive::BUNDLE,Hive::MENU_USER_AUTHORIZATIONS));

$html = null;
// Your Profile
try {
	$proid = $user->application()->proid;
	$profile = new Fox\Authorization\Profile($proid);
	$profileName  = $profile->pronm;
	$profileDescription  = $profile->text()->descr;
	// Find All Administration Users
	$users = Fox\Dao::finder(User::className())
				->where('cloudname = ?',array($user->cloudname()))
				->follow(User::LINK_APPLICATION)
					->where('webid = ? AND proid = ?',array(APPLICATION_ID,Hive::PROFILE_ADMIN))
					->find();
	$administrators = null;
	foreach($users as $user) {
		$administrators .= empty($administrators) ? $user->email : ','.$user->email;
	}
	$html .= Msg(Hive::BUNDLE,Hive::AUTHORIZATION_HELP_MESSAGE,$profileName,$profileDescription,$administrators);
} catch(Fox\Object\Exception\NotExist $e) {
	
}

?>
<div>
	<div class="page-header clearfix"><?php echo $header->render();?></div>
	<div class="contentArea">
		<div class="mbs ">
			<?php echo $html;?>
		</div>
	</div>
</div>